*** Settings ***
Documentation           通过Redfis获取thermal的model信息
Resource                ../../test_function/redfish/redfish.robot
Resource                ../../test_function/resource.robot
Library                 RequestsLibrary
Library                 Collections
Library                 BuiltIn
Suite Setup             Create REDFISH_GET Session
Suite Teardown          Delete All Sessions

*** Variables ***
${FAN_ID}               1
${INPUT_URI}            /Chassis/${CHASSIS_ID}/ThermalSubsystem/Fans/${FAN_ID}

*** Test Cases ***
Get Thermal Info Via Redfish
    [Documentation]    通过Redfish查询thermal的model信息
    [Tags]    Get_Thermal_Info_Via_Redfish
    # 发送GET请求
    ${rsp}=    Run Keyword And Ignore Error    GET On Session    redfish_get    ${INPUT_URI}

    Run Keyword If     '${rsp[0]}' == 'FAIL'    Fail    msg=获取bios设置失败: ${rsp[1]}

    # 验证响应状态码
    Should Be Equal As Strings    ${rsp[1].status_code}    ${SUCCESS_CODE}    msg=预期状态码200,实际收到${rsp[1].status_code}

    # 打印响应内容
    Log    ${rsp[1].json()}    level=INFO

    # 验证Fans的模型：02314BLG 8038+
    ${thermal_settings}=    Set Variable    ${rsp[1].json()}
    ${model_name}=    Set Variable    02314BLG 8038+

    # 检查响应中是否包含02314BLG 8038+
    Should Be Equal    ${thermal_settings['Model']}    ${model_name}
    Log    thermal的model为${model_name}的值为: ${thermal_settings['Model']}    level=INFO
